<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改直播')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-video-edit" th:object="${sysVideo}">
            <input name="VideoId" th:field="*{VideoId}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label">直播名称：</label>
                <div class="col-sm-8">
                    <input name="VideoName" th:field="*{VideoName}" class="form-control" type="text">
                </div>
            </div>
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">网页端流畅直播地址：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="RTMPSmoothAddress" th:field="*{RTMPSmoothAddress}" class="form-control" type="text">-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">网页端高清直播地址：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="RTMPHDAddress" th:field="*{RTMPHDAddress}" class="form-control" type="text">-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">移动端流畅直播地址：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="HLSSmoothAddress" th:field="*{HLSSmoothAddress}" class="form-control" type="text">-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">移动端高清直播地址：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="HLSHDAddress" th:field="*{HLSHDAddress}" class="form-control" type="text">-->
<!--                </div>-->
<!--            </div>-->
            <div class="form-group">    
                <label class="col-sm-3 control-label">直播开始时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="StartTime" th:value="${#dates.format(sysVideo.StartTime, 'yyyy-MM-dd HH:mm')}" class="form-control" placeholder="yyyy-MM-dd HH:mm" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">直播结束时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="EndTime" th:value="${#dates.format(sysVideo.EndTime, 'yyyy-MM-dd HH:mm')}" class="form-control" placeholder="yyyy-MM-dd HH:mm" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">封面图片：</label>
                <div class="col-sm-8">
                    <input type="hidden" name="Imgurl" th:field="*{Imgurl}">
                    <div class="file-loading">
                        <input class="form-control file-upload" id="Imgurl" name="file" type="file">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">简介：</label>
                <div class="col-sm-8">
                    <textarea name="Title" class="form-control">[[*{Title}]]</textarea>
                </div>
            </div>
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">本地录像：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="LocalVideo" th:field="*{LocalVideo}" class="form-control" type="text">-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">云存储录像：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="CloudVideo" th:field="*{CloudVideo}" class="form-control" type="text">-->
<!--                </div>-->
<!--            </div>-->
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: bootstrap-fileinput-js"/>
    <script th:inline="javascript">
        var prefix = ctx + "system/video";
        $("#form-video-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-video-edit').serialize());
            }
        }

        $("input[name='StartTime']").datetimepicker({
            format: "yyyy-mm-dd hh:ii",
            minView: "hour",
            autoclose: true
        });

        $("input[name='EndTime']").datetimepicker({
            format: "yyyy-mm-dd hh:ii",
            minView: "hour",
            autoclose: true
        });

        $(".file-upload").each(function (i) {
            var val = $("input[name='" + this.id + "']").val()
            $(this).fileinput({
                'uploadUrl': '/common/upload',
                initialPreviewAsData: true,
                initialPreview: [val],
                maxFileCount: 1,
                autoReplace: true
            }).on('fileuploaded', function (event, data, previewId, index) {
                $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
            }).on('fileremoved', function (event, id, index) {
                $("input[name='" + event.currentTarget.id + "']").val('')
            })
            $(this).fileinput('_initFileActions');
        });
    </script>
</body>
</html>